<?php
error_reporting(0);
require("Sajax.php");
include ('common/connection.php');
$queryUser="SELECT max(id) as id FROM `users`";
$resultUser=mysql_db_query($db_name,$queryUser);
$rsUser=mysql_fetch_array($resultUser);

$group=$_REQUEST['group'];
$batch=$_REQUEST['batch'];
$gender=$_REQUEST['gender'];
$full_name=$_REQUEST['full_name'];
$nick_name=$_REQUEST['nick_name'];
$cell_phone=$_REQUEST['cell_phone'];
$cell_phone1=$_REQUEST['cell_phone1'];
$email=$_REQUEST['email'];
$address=$_REQUEST['address'];
$amount=$_REQUEST['amount'];
$spouse=$_REQUEST['spouse'];
function generateRandomNumber($ranLength)
{
	$random_id_length = $ranLength; 
	$rnd_id = uniqid(rand(),1); 
	//$rnd_id = md5(uniqid(rand(), true));
	//$rnd_id = strip_tags(stripslashes($rnd_id)); 
	//$rnd_id = str_replace(".","",$rnd_id); 
	$rnd_id = strrev(str_replace("/","",$rnd_id)); 
	$rnd_id = substr($rnd_id,0,$random_id_length);	
	return $rnd_id;
}
$GenerateOrderId=generateRandomNumber("4");
# Define the email validation function
function validate($email) {
    if (preg_match(
    '/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$/',
    $email)) {
        return 'Valid';
    } else {
        return 'Invalid';
    }
}

# Initialize Sajax
sajax_init();
# Export the server-side function to Sajax
sajax_export('validate');
# Handle client request
sajax_handle_client_request();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>::.IBA REUNION 2012.::</title>
<link rel="stylesheet" href="style/style.css" type="text/css" /> 
<script language="javascript" src="jscript/digit.js"></script>

<script language="javascript">

<?php
        # Sajax toolkit generated javascript code
        sajax_show_javascript();
    ?>
    // Sends the email input to the server-side function
    // and throws the return value to showValidation.
    function js_validate(email) {
        x_validate(email, showValidation);
    }
    // Prints the return value on the screen.
    // Changes the container's font color to green
    // if the return value is "Valid" and
    // to red if not.
    function showValidation(html) {
        var element = document.getElementById('validation');
        element.innerHTML = html;
        if (html=='Valid')
            element.style.color = 'green';
        else
            element.style.color = 'red';
    }
window.onerror = null;
 var bName = navigator.appName;
 var bVer = parseInt(navigator.appVersion);
 var NS4 = (bName == "Netscape" && bVer >= 4);
 var IE4 = (bName == "Microsoft Internet Explorer" 
 && bVer >= 4);
 var NS3 = (bName == "Netscape" && bVer < 4);
 var IE3 = (bName == "Microsoft Internet Explorer" 
 && bVer < 4);
 var blink_speed=100;
 var i=0;
 
if (NS4 || IE4) {
 if (navigator.appName == "Netscape") {
 layerStyleRef="layer.";
 layerRef="document.layers";
 styleSwitch="";
 }else{
 layerStyleRef="layer.style.";
 layerRef="document.all";
 styleSwitch=".style";
 }
}

function Blink(layerName){
 if (NS4 || IE4) { 
 if(i%2==0)
 {
 eval(layerRef+'["'+layerName+'"]'+
 styleSwitch+'.visibility="visible"');
 }
 else
 {
 eval(layerRef+'["'+layerName+'"]'+
 styleSwitch+'.visibility="hidden"');
 }
 } 
 if(i<1)
 {
 i++;
 } 
 else
 {
 i--
 }
 setTimeout("Blink('"+layerName+"')",blink_speed);
}
function selectgroup()
{
	document.regis.action="final.php";
	document.regis.submit();	
}
</script>
</head>

<body topmargin="0" leftmargin="0">

    <form name="regis" action="preview.php" method="post">
   <table>
      <tr>
        <td colspan="2"><table width="100%" border="0" bgcolor="#000000" cellpadding="1" cellspacing="1">
          <tr>
            <td bgcolor="#ffffff"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><table width="800" border="0">
                <tr>
                	<td align="right" valign="bottom"><span class="fieldname">Group</span></td>
                    <td valign="bottom"><span class="fieldname">:</span></td>
                    <td valign="bottom"><select name="group" id="group" onchange="selectgroup()">
                      <option value="">&nbsp;&nbsp;- - -</option>
                      <option value="1"<?php if($group==1){echo "Selected";}?>>BBA</option>
                      <option value="2"<?php if($group==2){echo "Selected";}?>>MBA</option>
                      <option value="3"<?php if($group==3){echo "Selected";}?>>EMBA</option>
                      <option value="4"<?php if($group==4){echo "Selected";}?>>Fellow</option>
                      <option value="5"<?php if($group==5){echo "Selected";}?>>Honorary</option>
                      <option value="6"<?php if($group==6){echo "Selected";}?>>Associate</option>
                    </select></td>
                    <td colspan="2" valign="bottom"><table width="100%" border="0">
                      <tr height="10">
                        <td width="54%" align="right"><span class="fieldname">Batch</span></td>
                        <td width="3%"><span class="fieldname">:</span></td>
                        <td width="43%" align="left"><select name="batch" id="batch">
                          <option value="">- - -</option>
                          <?php if($group==1){$s=1;$limit=15;}elseif($group==2){$s=1;$limit=43;}elseif($group==3){$s=1; $limit=6;}elseif($group==4){$s=0;$limit=0;}elseif($group==5){$s=0;$limit=0;}elseif($group==6){$s=0;$limit=0;}else {$s=1;}for($b=$s;$b<=$limit;$b++){?>
                          <option value="<?php if($b<=9){echo "0".$b;}else{echo $b;}?>"<?php if($_GET['batch']==$b){echo "Selected";}?>>
                            <?php if($b<=9){echo "0".$b;}else{echo $b;}?>
                            </option>
                          <?php }?>
                        </select></td>
                      </tr>
                    </table></td>
                    <td align="right" valign="bottom"><span class="fieldname"></span></td>
                    <td valign="bottom"><span class="fieldname"></span></td>
                    <td width="30%" colspan="3" valign="bottom"></td>
                    </tr>
                  
                  <tr>
                    <td align="right">&nbsp;</td>
                    <td align="center">&nbsp;</td>
                    <td colspan="2" align="left" valign="top" class="commenttext">Please Enter Cell Number<td align="center" valign="top">&nbsp;</td>
                    <td align="center" valign="top">&nbsp;</td>
                    <td align="center" valign="top">&nbsp;</td>
                    <td colspan="3" align="left" valign="top" class="commenttext">Alternate Cell Number (If Any)</tr>
                  <tr>
                    <td align="right" class="fieldname">Email</td>
                    <td align="center" class="fieldname">:</td>
                    <td colspan="2" align="left"><input type="text" name="email" id="email" onkeyup="js_validate(this.value)" value="<?php echo $_GET['email'];?>"/>&nbsp; <span style="font-weight:bold;" id="validation"></span></td>
                    <td align="center">&nbsp;</td>
                    <td align="right" class="fieldname">Confirm Email</td>
                    <td align="right" class="fieldname">:</td>
                    <td colspan="3" align="left"><input type="text" name="conemail" id="conemail" onkeyup="js_validate(this.value)"/>&nbsp;</td>
                    </tr>
                  <tr>
                    <td align="right">&nbsp;</td>
                    <td align="center">&nbsp;</td>
                    <td colspan="4" align="left" valign="top" class="commenttext">Please Enter Valid Email Address<br />
                      Registration Confirmation Will Be Sent To This Address</td>
                    <td align="center" valign="top">&nbsp;</td>
                    <td colspan="3" align="left" valign="top" class="commenttext">Re-Enter
                      The Same Email Address.</td>
                    </tr>
                  
                  
                  
                  
                </table>                  </td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr>
        </td>
      </tr>
     
      <tr>
        <td colspan="2">&nbsp;</td>
      </tr>
      
                
                  
                  <tr>
                    <td colspan="2" align="center"><input type="submit" name="button" id="button" value="Submit" onclick="return validation()" /><input type="hidden" name="origin" value="<?php echo $origi;?>" /></td>
                  </tr>
                  
                </table></td>
              </tr>
              
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td colspan="2">&nbsp;</td>
      </tr>
    </table>
    </form>
    </td>
  </tr>
</table>
</body>
</html>
